function bd = testProjection(P,img,zx,zy,sx,sy)
% this version is modified from the corresponding file in codeEM;
% besides showing the projected outline of car, its bounding box 
% is also estimated
X = load('frame_pts_v2.csv');
n_pts = size(X,1);
X = [X,ones(n_pts,1)]';
x = P*X;
for i_pt = 1:n_pts
    x(:,i_pt) = x(:,i_pt)/x(3,i_pt);
end
x(1,:) = x(1,:)*zy+sy/2;
x(2,:) = x(2,:)*zx+sx/2;


if usejava('desktop')

figure;
imshow(img);
hold on;

plot(x(1,1:16),x(2,1:16),'s','markerSize',4,'linewidth',2)

s_pts=[1:8];e_pts=[2:8,1];
line_x = [x(1,s_pts);x(1,e_pts)];
line_y = [x(2,s_pts);x(2,e_pts)];
line(line_x,line_y,'color','r','linewidth',2);

s_pts=[9:16];e_pts=[10:16,9];
line_x = [x(1,s_pts);x(1,e_pts)];
line_y = [x(2,s_pts);x(2,e_pts)];
line(line_x,line_y,'color','g','linewidth',2);

s_pts = [2,1,3,4];
e_pts = [16,9,15,14];
line_x = [x(1,s_pts);x(1,e_pts)];
line_y = [x(2,s_pts);x(2,e_pts)];
line(line_x,line_y,'color','b','linewidth',2);

s_pts = [5,6,7,8];
e_pts = [13,12,11,10];
line_x = [x(1,s_pts);x(1,e_pts)];
line_y = [x(2,s_pts);x(2,e_pts)];
line(line_x,line_y,'color','y','linewidth',2);
end


bd = zeros(4,1);
bd(1) = min(x(1,:));
bd(2) = max(x(1,:));
bd(3) = min(x(2,:));
bd(4) = max(x(2,:));



hold off;
